Fix GP7 score metadata export for Guitar Pro multitrack view#2774
Open
chenkigba wants to merge 1 commit into
Open
Fix GP7 score metadata export for Guitar Pro multitrack view#2774chenkigba wants to merge 1 commit into
chenkigba wants to merge 1 commit into
Conversation
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
This PR fixes a small GPIF metadata serialization issue in the GP7/GP8 exporter that can make Guitar Pro 8 unstable when switching an exported
.gpfile to multitrack view.The change is intentionally minimal:
ScoreSystemsDefaultLayoutas text instead of CDATAScoreSystemsLayoutas text instead of CDATAMultiVoiceas0instead of the invalid-looking1>valueContent/score.gpifRoot cause
Before this change, alphaTab exports the top-level GPIF score metadata like this:
Files with this shape can open in Guitar Pro 8, but switching to multitrack view can trigger abnormal memory growth. Native Guitar Pro files use plain text for these layout fields, and a stable
MultiVoicevalue:Reproduction
Content/score.gpifin the exported.gpzip..gpin Guitar Pro 8.Observed with Guitar Pro 8.1.5 on macOS: the file opens, but switching to multitrack view can increase RSS from about
450 MBto about2.48 GBbefore the process is killed by the probe threshold.Verification
Unit tests
npm ci npm run generate-typescript --workspace=packages/alphatab npm run test --workspace=packages/alphatab -- test/exporter/Gp7Exporter.test.ts npm run typecheck --workspace=packages/alphatab npm run lint --workspace=packages/alphatabResults from this branch:
Gp7Exporter.test.ts: 19 passedtypecheck: passedlint: exited successfully; it reports existing warnings unrelated to this PRExported GPIF check
The new test
alphatex-to-gp7-score-metadataexports a two-track AlphaTex score and asserts that the exported GPIF contains:and no longer contains:
Guitar Pro 8 UI validation
I also generated a
.gpfile from this patched branch and opened it with Guitar Pro 8.1.5 on macOS. A small probe script opened the file, clicked the多音轨/ multitrack menu item via System Events, and sampled process RSS.Patched branch result:
{ "ok": true, "stage": "done", "reason": "opened and switched multitrack within thresholds", "appVersion": "8.1.5-31", "openMaxRssMb": 414.3, "switchMaxRssMb": 421.3, "switchGrowthMb": 7.0, "clickResult": "clicked 多音轨" }The same problematic file shape before the metadata fix failed the probe after switching to multitrack view:
{ "ok": false, "stage": "switch-monitor", "reason": "rss exceeded limit: 2482.2 MB >= 1536.0 MB", "appVersion": "8.1.5-31", "openMaxRssMb": 450.6, "switchMaxRssMb": 2482.2, "switchGrowthMb": 2031.6, "clickResult": "clicked 多音轨" }